﻿<navigation:Page x:Class="SGTLightAccent.Views.Puertos" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
           xmlns:behaviors="clr-namespace:SGTLightAccent.Models"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" Title="Puertos Page"
           DataContext="{Binding Main, Source={StaticResource Locator}}" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" d:DesignHeight="895" d:DesignWidth="800" xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit">
	<sdk:Page.Resources>
		
	<!-- DataTemplate for Origins -->
		<DataTemplate x:Key="EditTemplateDF">
			<Grid Width="370" Background="#AA000000" d:DesignHeight="227">
                <sdk:Label HorizontalAlignment="Left" Height="31" Margin="21,21,0,0" VerticalAlignment="Top" Width="77" Content="{Binding Path=Nombre}"  />
                <TextBox Height="31" Margin="98,21,137,0" TextWrapping="Wrap"  VerticalAlignment="Top" Text="{Binding Path=Proveedor}"/>
			</Grid>
		</DataTemplate>
		
	</sdk:Page.Resources>
    
        <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="600*" />
        </Grid.RowDefinitions>
            <sdk:TabControl Name="tabControl1" TabStripPlacement="Top"  BorderThickness="1" Margin="0,0,0,0">
            <sdk:TabItem Header="Descargas" Height="33" VerticalAlignment="Center" >
                <StackPanel>
                    <Border BorderBrush="Silver" BorderThickness="1" Height="143" HorizontalAlignment="Center" Margin="10,10,0,0" Name="borderDescagas" VerticalAlignment="Top" Width="534"  >
                        <Grid Background="White" HorizontalAlignment="Left" Width="533" Height="142" VerticalAlignment="Top">
                        	<sdk:Label Content="N° Barco" FontWeight="Bold" Height="28" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="11,14,0,0" x:Name="labeld1" VerticalAlignment="Top" Width="62" />
                        	<sdk:Label Content="Entre" FontWeight="Bold" Height="28" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="0,54,455,0" x:Name="labeld2" VerticalAlignment="Top" Width="62" />
                        	<sdk:Label Content="Producto" FontWeight="Bold" Height="28" HorizontalAlignment="Right" HorizontalContentAlignment="Right" Margin="0,12,223,0" x:Name="labeld3" VerticalAlignment="Top" Width="67" />
                        	<TextBox Height="28" HorizontalAlignment="Left" IsReadOnly="True" Margin="79,12,0,0" x:Name="textBoxd1" Text="{Binding Mode=TwoWay, Path=FiltroNroBarco}" VerticalAlignment="Top" Width="117" />
                        	<TextBox Height="28" HorizontalAlignment="Right" Margin="0,12,37,0" x:Name="textBoxd3" Text="{Binding Mode=TwoWay, Path=FiltroProducto}" VerticalAlignment="Top" Width="180" />
                        	<Button Command="{Binding BotonBuscarCarga}" Content="Buscar" Height="33" Margin="0,103,6,0" x:Name="buttond2" Width="65" VerticalAlignment="Top" HorizontalAlignment="Right" />
                        	<sdk:DatePicker Height="28" HorizontalAlignment="Left" Margin="79,54,0,0" x:Name="datePicker1" VerticalAlignment="Top" Width="117" SelectedDate="{Binding Path=FiltroFechaIni, Mode=TwoWay}" />
                        	<sdk:Label Content="y" FontWeight="Bold" Height="28" HorizontalContentAlignment="Center" Margin="238,56,223,0" x:Name="label4" VerticalAlignment="Top" HorizontalAlignment="Center" Width="67" />
                        	<sdk:DatePicker Height="28" HorizontalAlignment="Left" Margin="316,56,0,0" x:Name="datePicker2" VerticalAlignment="Top" Width="180" SelectedDate="{Binding Path=FiltroFechaFin, Mode=TwoWay}" />
                            <CheckBox HorizontalAlignment="Center" Margin="202,14,306,104" Name="chkBarco" VerticalAlignment="Center" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" RenderTransformOrigin="0.6,0.5" IsChecked="{Binding Path=FiltroChkBarco, Mode=TwoWay}" />
                            <CheckBox HorizontalAlignment="Center" HorizontalContentAlignment="Center" Margin="202,54,306,64" Name="chkFchIni" VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding Path=FiltroChkFchIni, Mode=TwoWay}" />
                            <CheckBox HorizontalAlignment="Center" HorizontalContentAlignment="Center" Margin="498,14,10,104" Name="chkProducto" VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding Path=FiltroChkProducto, Mode=TwoWay}" />
                            <CheckBox HorizontalAlignment="Center" HorizontalContentAlignment="Center" Margin="498,56,10,62" Name="chkFchFin" VerticalAlignment="Center" VerticalContentAlignment="Center" IsChecked="{Binding Path=FiltroFechaFin, Mode=TwoWay}" />
                        </Grid>
                    </Border>
                    <Grid Height="439" Name="grid1" Width="800" Margin="0,20,0,0">
                        <sdk:DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Path=Cargas}" Margin="0,39,0,6" Name="dataGrid2" IsReadOnly="True"
                           SelectionMode="Single" 
                              SelectedItem="{Binding Path=CargaSeleccionada, Mode=TwoWay}"
                                      >
                            <sdk:DataGrid.Columns>
                                <sdk:DataGridTextColumn Binding="{Binding Path=Id}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="N°" Width="50" />
                                <sdk:DataGridTextColumn Binding="{Binding Path=Barco.Nombre}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Barco" Width="170" />
                                <sdk:DataGridTextColumn Binding="{Binding Path=Fecha_Ingreso}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Fecha entrada" Width="125*" />
                                <sdk:DataGridTextColumn Binding="{Binding Path=Fecha_Salida}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Fecha fin" Width="125*" />
                                <sdk:DataGridTextColumn Binding="{Binding Path=Peso}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Carga Neta" Width="110" />
                                
                            </sdk:DataGrid.Columns>
                            <i:Interaction.Behaviors>
                                <behaviors:DataGridDoubleClickBehavior
                                        DoubleClickCommand="{Binding Path=BotonActualizarCarga}" 
                                        CommandParameter="{Binding SelectedItem, ElementName=dataGrid2}"/>

                            </i:Interaction.Behaviors>
                            <toolkit:ContextMenuService.ContextMenu>
                                <toolkit:ContextMenu>
                                    <toolkit:MenuItem Header="Eliminar descarga" Command="{Binding Path=BotonEliminarDescarga}" />
                                </toolkit:ContextMenu>
                            </toolkit:ContextMenuService.ContextMenu>
                        </sdk:DataGrid>
                        <toolkit:BusyIndicator IsBusy="{Binding Path=EstaCargando}" DisplayAfter="0" BusyContent="Buscando descargas...">

                        </toolkit:BusyIndicator>
                        <Button Command="{Binding Path=BotonNuevaCarga}" Content="Nueva" Height="33" Name="button3" Width="65" HorizontalAlignment="Left" Margin="0,0,0,406" />
                    </Grid>
                </StackPanel>
               
            </sdk:TabItem>
            <sdk:TabItem Header="Adm. Barcos" VerticalAlignment="Center" Height="33" >
                <StackPanel>
                    <Border BorderBrush="Silver" BorderThickness="1" Height="119" HorizontalAlignment="Center" Margin="10,10,0,0" Name="border1" VerticalAlignment="Top" Width="568" Background="{x:Null}">
                        <Grid Width="567" Height="118" Background="White">
                            <sdk:Label Height="28" HorizontalAlignment="Left" Margin="21,16,0,0" Name="label1" VerticalAlignment="Top" Width="70" Content="N° Barco" FontWeight="Bold" HorizontalContentAlignment="Right" />
                            <sdk:Label Height="28" HorizontalAlignment="Left" Margin="21,64,0,0" Name="label2" VerticalAlignment="Top" Width="70" Content="Nombre" FontWeight="Bold" HorizontalContentAlignment="Right" />
                            <sdk:Label Height="28" HorizontalAlignment="Left" Margin="275,16,0,0" Name="label3" VerticalAlignment="Top" Width="70" Content="Empresa" FontWeight="Bold" HorizontalContentAlignment="Right" />
                            <TextBox Height="23" HorizontalAlignment="Left" Margin="89,14,0,0" Name="textBox1" VerticalAlignment="Top" Width="165" IsReadOnly="True" />
                            <TextBox Height="23" Margin="89,62,0,0" Name="textBox2" VerticalAlignment="Top" HorizontalAlignment="Left" Width="165" />
                            <TextBox Height="23" Margin="0,16,28,0" Name="textBox3" VerticalAlignment="Top" HorizontalAlignment="Right" Width="188" />
                            <Button Content="Buscar" Margin="465,62,28,0" Name="button2" Height="33" VerticalAlignment="Top" Command="{Binding Path=BotonBuscarBarco}" />
                        </Grid>
                    </Border>
                    <Grid Width="600" Height="400" Margin="0,10,0,0">
                    <sdk:DataGrid AutoGenerateColumns="False" Name="dataGrid1" ItemsSource="{Binding Path=Barcos}" SelectionMode="Single" 
                              SelectedItem="{Binding Path=BarcoSeleccionado, Mode=TwoWay}" Width="600" Height="300" IsReadOnly="True">
                        <sdk:DataGrid.Columns>
                            <sdk:DataGridTextColumn Binding="{Binding Path=id}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Width="100" Header="N° Barco" />
                            <sdk:DataGridTextColumn Binding="{Binding Path=Nombre}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Nombre" Width="200" />
                            <sdk:DataGridTextColumn Binding="{Binding Path=Empresa}" CanUserReorder="True" CanUserResize="True" CanUserSort="True" Header="Empresa" Width="400*" />
                        </sdk:DataGrid.Columns>
                            <i:Interaction.Behaviors>
                                <behaviors:DataGridDoubleClickBehavior
                                        DoubleClickCommand="{Binding Path=BotonActualizarBarco}" 
                                        CommandParameter="{Binding SelectedItem, ElementName=dataGrid1}"/>

                            </i:Interaction.Behaviors>
                        </sdk:DataGrid>
                        <Button Command="{Binding Path=BotonNuevoBarco}" Content="Nuevo" Height="33" Margin="0,0,526,0" Name="button1" VerticalAlignment="Top" />
                    </Grid>
                </StackPanel>



            </sdk:TabItem>
            </sdk:TabControl>
                
    </Grid>
   
</navigation:Page>
